Test Series - java script

Test Number 38/92

Q: When are the keyboard events fired?
A. When the user manually calls the button
B. When the user clicks a key
C. When the user calls the modifier
D. When the user right clicks the mouse
Solution: The keydown and keyup are the keyboard events are fired when the user presses or releases a key on the keyboard. They are generated for modifier keys, function keys, and alphanumeric keys.
Q: How does a user generate multiple keydown events?
A. Repeating the same process
B. Pressing multiple keys
C. Pressing the key longer than usual
D. Pressing the key multiple times
Solution: If the user holds the key down long enough for it to begin repeating, there will be multiple keydown events before the keyup event arrives. Pressing the key for long time results in multiple calls to the function onkeypress.
Q: Which property is used to specify the key type when pressed?
A. keyCode
B. keyType
C. keyName
D. keyProperty
Solution: The keyCode property returns the Unicode character code of the key that triggered the onkeypress event, or the Unicode key code of the key that triggered the onkeydown or onkeyup event. The event object associated with these events has a numeric keyCode property that specifies which key was pressed.
Q: For what value does the keyCode property persists even when a Shift key is pressed for adding punctuation character.
A. Special characters
B. Alphabets
C. Alphanumeric
D. Digits
Solution: The number keys always generate keyCode values for the digit that appears on the key, even if you are holding down Shift in order to type a punctuation character.
Q: Which of the following are not key event properties?
A. Code key
B. Alt Key
C. Ctrl Key
D. Shift Key
Solution: altKey, ctrlKeY, shiftKey, and metaKey are key event object’s properties, which are set to true if the corresponding modifier key is held down when the event occurs. The keyCode values of ShiftKey, ctrlKey, altKey are respectively 16, 17 and 18.
Q: Which of the following key property holds the key name as a string?
A. keyName
B. key
C. keyName(string)
D. Nameofkey(string)
Solution: The DOM Level 3 Events defines a new key property that contains the key name as a string. Object.keys() returns an array whose elements are strings corresponding to the enumerable properties found directly upon object.
Q: Which of the following is not the value the key property will hold if the key is a function key?
A. F8
B. F2
C. F9
D. Left
Solution: If the key is a function key, the key property will be a value like “F2”, ”F8” or ”F9”etc. The Keys from F1-F12 are known as function keys.
Q: Which method is used to add a binding?
A. binding()
B. add_bind()
C. bind()
D. addbind()
Solution: The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.
Q: Which method is used to remove a binding?
A. Unbind()
B. removebind()
C. remove(Bind b)
D. unbind()
Solution: The unbind() method removes event handlers from selected elements. This method can remove all or selected event handlers, or stop specified functions from running when the event occurs.
Q: Which of the following are the parameters passed to the keymap after installation?
A. Key property
B. Key name
C. Keydown event’s object
D. Key stroke
Solution: After the keymap is installed, the following parameters are passed:
The event object for the keydown event.
The key identifier of the key that was pressed.
Identifier key contains the information of the key that is pressed and the object information about the function to be performed when the key is pressed.

You Have Score    /10